
<!DOCTYPE html>

<html>
  
<!-- Mirrored from docs.sympy.org/latest/modules/parsing.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:24:35 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

    <title>Parsing &#8212; SymPy 1.9 documentation</title>
    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/default.css" />
    <link rel="stylesheet" type="text/css" href="../_static/graphviz.css" />
    <link rel="stylesheet" type="text/css" href="../_static/plot_directive.css" />
    <link rel="stylesheet" type="text/css" href="../../../live.sympy.org/static/live-core.css" />
    <link rel="stylesheet" type="text/css" href="../../../live.sympy.org/static/live-autocomplete.css" />
    <link rel="stylesheet" type="text/css" href="../../../live.sympy.org/static/live-sphinx.css" />
    
    <script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
    <script src="../_static/jquery.js"></script>
    <script src="../_static/underscore.js"></script>
    <script src="../_static/doctools.js"></script>
    <script src="../../../live.sympy.org/static/utilities.js"></script>
    <script src="../../../live.sympy.org/static/external/classy.js"></script>
    <script src="../../../live.sympy.org/static/live-core.js"></script>
    <script src="../../../live.sympy.org/static/live-autocomplete.js"></script>
    <script src="../../../live.sympy.org/static/live-sphinx.js"></script>
    <script async="async" src="../../../cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest8331.js?config=TeX-AMS_HTML-full"></script>
    <script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["\\(", "\\)"]], "displayMath": [["\\[", "\\]"]]}})</script>
    
    <link rel="shortcut icon" href="../_static/sympy-notailtext-favicon.ico"/>
    <link href="parsing.html" rel="canonical" />
    
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="PDE" href="solvers/pde.html" />
    <link rel="prev" title="ODE" href="solvers/ode.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="solvers/pde.html" title="PDE"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="solvers/ode.html" title="ODE"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">SymPy Modules Reference</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Parsing</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="module-sympy.parsing">
<span id="parsing"></span><h1>Parsing<a class="headerlink" href="#module-sympy.parsing" title="Permalink to this headline">¶</a></h1>
<section id="parsing-functions-reference">
<h2>Parsing Functions Reference<a class="headerlink" href="#parsing-functions-reference" title="Permalink to this headline">¶</a></h2>
<dl class="py function">
<dt class="sig sig-object py" id="sympy.parsing.sympy_parser.parse_expr">
<span class="sig-prename descclassname"><span class="pre">sympy.parsing.sympy_parser.</span></span><span class="sig-name descname"><span class="pre">parse_expr</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">s</span></em>, <em class="sig-param"><span class="pre">local_dict=None</span></em>, <em class="sig-param"><span class="pre">transformations=(&lt;function</span> <span class="pre">lambda_notation&gt;</span></em>, <em class="sig-param"><span class="pre">&lt;function</span> <span class="pre">auto_symbol&gt;</span></em>, <em class="sig-param"><span class="pre">&lt;function</span> <span class="pre">repeated_decimals&gt;</span></em>, <em class="sig-param"><span class="pre">&lt;function</span> <span class="pre">auto_number&gt;</span></em>, <em class="sig-param"><span class="pre">&lt;function</span> <span class="pre">factorial_notation&gt;)</span></em>, <em class="sig-param"><span class="pre">global_dict=None</span></em>, <em class="sig-param"><span class="pre">evaluate=True</span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/sympy_parser.py#L916-L1026"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.sympy_parser.parse_expr" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the string <code class="docutils literal notranslate"><span class="pre">s</span></code> to a SymPy expression, in <code class="docutils literal notranslate"><span class="pre">local_dict</span></code></p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>s</strong> : str</p>
<blockquote>
<div><p>The string to parse.</p>
</div></blockquote>
<p><strong>local_dict</strong> : dict, optional</p>
<blockquote>
<div><p>A dictionary of local variables to use when parsing.</p>
</div></blockquote>
<p><strong>global_dict</strong> : dict, optional</p>
<blockquote>
<div><p>A dictionary of global variables. By default, this is initialized
with <code class="docutils literal notranslate"><span class="pre">from</span> <span class="pre">sympy</span> <span class="pre">import</span> <span class="pre">*</span></code>; provide this parameter to override
this behavior (for instance, to parse <code class="docutils literal notranslate"><span class="pre">&quot;Q</span> <span class="pre">&amp;</span> <span class="pre">S&quot;</span></code>).</p>
</div></blockquote>
<p><strong>transformations</strong> : tuple, optional</p>
<blockquote>
<div><p>A tuple of transformation functions used to modify the tokens of the
parsed expression before evaluation. The default transformations
convert numeric literals into their SymPy equivalents, convert
undefined variables into SymPy symbols, and allow the use of standard
mathematical factorial notation (e.g. <code class="docutils literal notranslate"><span class="pre">x!</span></code>).</p>
</div></blockquote>
<p><strong>evaluate</strong> : bool, optional</p>
<blockquote>
<div><p>When False, the order of the arguments will remain as they were in the
string and automatic simplification that would normally occur is
suppressed. (see examples)</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.parsing.sympy_parser</span> <span class="kn">import</span> <span class="n">parse_expr</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">parse_expr</span><span class="p">(</span><span class="s2">&quot;1/2&quot;</span><span class="p">)</span>
<span class="go">1/2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">type</span><span class="p">(</span><span class="n">_</span><span class="p">)</span>
<span class="go">&lt;class &#39;sympy.core.numbers.Half&#39;&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.parsing.sympy_parser</span> <span class="kn">import</span> <span class="n">standard_transformations</span><span class="p">,</span>\
<span class="gp">... </span><span class="n">implicit_multiplication_application</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">transformations</span> <span class="o">=</span> <span class="p">(</span><span class="n">standard_transformations</span> <span class="o">+</span>
<span class="gp">... </span>    <span class="p">(</span><span class="n">implicit_multiplication_application</span><span class="p">,))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">parse_expr</span><span class="p">(</span><span class="s2">&quot;2x&quot;</span><span class="p">,</span> <span class="n">transformations</span><span class="o">=</span><span class="n">transformations</span><span class="p">)</span>
<span class="go">2*x</span>
</pre></div>
</div>
<p>When evaluate=False, some automatic simplifications will not occur:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">parse_expr</span><span class="p">(</span><span class="s2">&quot;2**3&quot;</span><span class="p">),</span> <span class="n">parse_expr</span><span class="p">(</span><span class="s2">&quot;2**3&quot;</span><span class="p">,</span> <span class="n">evaluate</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="go">(8, 2**3)</span>
</pre></div>
</div>
<p>In addition the order of the arguments will not be made canonical.
This feature allows one to tell exactly how the expression was entered:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">parse_expr</span><span class="p">(</span><span class="s1">&#39;1 + x&#39;</span><span class="p">,</span> <span class="n">evaluate</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">parse_expr</span><span class="p">(</span><span class="s1">&#39;x + 1&#39;</span><span class="p">,</span> <span class="n">evaluate</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">==</span> <span class="n">b</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="o">.</span><span class="n">args</span>
<span class="go">(1, x)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span><span class="o">.</span><span class="n">args</span>
<span class="go">(x, 1)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.parsing.sympy_parser.stringify_expr" title="sympy.parsing.sympy_parser.stringify_expr"><code class="xref py py-obj docutils literal notranslate"><span class="pre">stringify_expr</span></code></a>, <a class="reference internal" href="#sympy.parsing.sympy_parser.eval_expr" title="sympy.parsing.sympy_parser.eval_expr"><code class="xref py py-obj docutils literal notranslate"><span class="pre">eval_expr</span></code></a>, <a class="reference internal" href="#sympy.parsing.sympy_parser.standard_transformations" title="sympy.parsing.sympy_parser.standard_transformations"><code class="xref py py-obj docutils literal notranslate"><span class="pre">standard_transformations</span></code></a>, <a class="reference internal" href="#sympy.parsing.sympy_parser.implicit_multiplication_application" title="sympy.parsing.sympy_parser.implicit_multiplication_application"><code class="xref py py-obj docutils literal notranslate"><span class="pre">implicit_multiplication_application</span></code></a></p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.parsing.sympy_parser.stringify_expr">
<span class="sig-prename descclassname"><span class="pre">sympy.parsing.sympy_parser.</span></span><span class="sig-name descname"><span class="pre">stringify_expr</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">s</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">local_dict</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">global_dict</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">transformations</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/sympy_parser.py#L887-L902"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.sympy_parser.stringify_expr" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the string <code class="docutils literal notranslate"><span class="pre">s</span></code> to Python code, in <code class="docutils literal notranslate"><span class="pre">local_dict</span></code></p>
<p>Generally, <code class="docutils literal notranslate"><span class="pre">parse_expr</span></code> should be used.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.parsing.sympy_parser.eval_expr">
<span class="sig-prename descclassname"><span class="pre">sympy.parsing.sympy_parser.</span></span><span class="sig-name descname"><span class="pre">eval_expr</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">code</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">local_dict</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">global_dict</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/sympy_parser.py#L905-L913"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.sympy_parser.eval_expr" title="Permalink to this definition">¶</a></dt>
<dd><p>Evaluate Python code generated by <code class="docutils literal notranslate"><span class="pre">stringify_expr</span></code>.</p>
<p>Generally, <code class="docutils literal notranslate"><span class="pre">parse_expr</span></code> should be used.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.parsing.maxima.parse_maxima">
<span class="sig-prename descclassname"><span class="pre">sympy.parsing.maxima.</span></span><span class="sig-name descname"><span class="pre">parse_maxima</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">globals</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name_dict</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">{}</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/maxima.py#L48-L68"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.maxima.parse_maxima" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.parsing.mathematica.mathematica">
<span class="sig-prename descclassname"><span class="pre">sympy.parsing.mathematica.</span></span><span class="sig-name descname"><span class="pre">mathematica</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">s</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">additional_translations</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/mathematica.py#L8-L25"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.mathematica.mathematica" title="Permalink to this definition">¶</a></dt>
<dd><p>Users can add their own translation dictionary.
variable-length argument needs ‘*’ character.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.parsing.mathematica</span> <span class="kn">import</span> <span class="n">mathematica</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">mathematica</span><span class="p">(</span><span class="s1">&#39;Log3[9]&#39;</span><span class="p">,</span> <span class="p">{</span><span class="s1">&#39;Log3[x]&#39;</span><span class="p">:</span><span class="s1">&#39;log(x,3)&#39;</span><span class="p">})</span>
<span class="go">2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">mathematica</span><span class="p">(</span><span class="s1">&#39;F[7,5,3]&#39;</span><span class="p">,</span> <span class="p">{</span><span class="s1">&#39;F[*x]&#39;</span><span class="p">:</span><span class="s1">&#39;Max(*x)*Min(*x)&#39;</span><span class="p">})</span>
<span class="go">21</span>
</pre></div>
</div>
</dd></dl>

</section>
<section id="parsing-transformations-reference">
<h2>Parsing Transformations Reference<a class="headerlink" href="#parsing-transformations-reference" title="Permalink to this headline">¶</a></h2>
<p>A transformation is a function that accepts the arguments <code class="docutils literal notranslate"><span class="pre">tokens,</span>
<span class="pre">local_dict,</span> <span class="pre">global_dict</span></code> and returns a list of transformed tokens. They can
be used by passing a list of functions to <a class="reference internal" href="#sympy.parsing.sympy_parser.parse_expr" title="sympy.parsing.sympy_parser.parse_expr"><code class="xref py py-func docutils literal notranslate"><span class="pre">parse_expr()</span></code></a> and are
applied in the order given.</p>
<dl class="py data">
<dt class="sig sig-object py" id="sympy.parsing.sympy_parser.standard_transformations">
<span class="sig-prename descclassname"><span class="pre">sympy.parsing.sympy_parser.</span></span><span class="sig-name descname"><span class="pre">standard_transformations</span></span><em class="property"> <span class="pre">=</span> <span class="pre">(&lt;function</span> <span class="pre">lambda_notation&gt;,</span> <span class="pre">&lt;function</span> <span class="pre">auto_symbol&gt;,</span> <span class="pre">&lt;function</span> <span class="pre">repeated_decimals&gt;,</span> <span class="pre">&lt;function</span> <span class="pre">auto_number&gt;,</span> <span class="pre">&lt;function</span> <span class="pre">factorial_notation&gt;)</span></em><a class="headerlink" href="#sympy.parsing.sympy_parser.standard_transformations" title="Permalink to this definition">¶</a></dt>
<dd><p>Standard transformations for <a class="reference internal" href="#sympy.parsing.sympy_parser.parse_expr" title="sympy.parsing.sympy_parser.parse_expr"><code class="xref py py-func docutils literal notranslate"><span class="pre">parse_expr()</span></code></a>.
Inserts calls to <a class="reference internal" href="core.html#sympy.core.symbol.Symbol" title="sympy.core.symbol.Symbol"><code class="xref py py-class docutils literal notranslate"><span class="pre">Symbol</span></code></a>, <a class="reference internal" href="core.html#sympy.core.numbers.Integer" title="sympy.core.numbers.Integer"><code class="xref py py-class docutils literal notranslate"><span class="pre">Integer</span></code></a>, and other SymPy
datatypes and allows the use of standard factorial notation (e.g. <code class="docutils literal notranslate"><span class="pre">x!</span></code>).</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.parsing.sympy_parser.split_symbols">
<span class="sig-prename descclassname"><span class="pre">sympy.parsing.sympy_parser.</span></span><span class="sig-name descname"><span class="pre">split_symbols</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tokens</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">local_dict</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">global_dict</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/sympy_parser.py#L392-L446"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.sympy_parser.split_symbols" title="Permalink to this definition">¶</a></dt>
<dd><p>Splits symbol names for implicit multiplication.</p>
<p>Intended to let expressions like <code class="docutils literal notranslate"><span class="pre">xyz</span></code> be parsed as <code class="docutils literal notranslate"><span class="pre">x*y*z</span></code>. Does not
split Greek character names, so <code class="docutils literal notranslate"><span class="pre">theta</span></code> will <em>not</em> become
<code class="docutils literal notranslate"><span class="pre">t*h*e*t*a</span></code>. Generally this should be used with
<code class="docutils literal notranslate"><span class="pre">implicit_multiplication</span></code>.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.parsing.sympy_parser.split_symbols_custom">
<span class="sig-prename descclassname"><span class="pre">sympy.parsing.sympy_parser.</span></span><span class="sig-name descname"><span class="pre">split_symbols_custom</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">predicate</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/sympy_parser.py#L370-L448"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.sympy_parser.split_symbols_custom" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates a transformation that splits symbol names.</p>
<p><code class="docutils literal notranslate"><span class="pre">predicate</span></code> should return True if the symbol name is to be split.</p>
<p>For instance, to retain the default behavior but avoid splitting certain
symbol names, a predicate like this would work:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.parsing.sympy_parser</span> <span class="kn">import</span> <span class="p">(</span><span class="n">parse_expr</span><span class="p">,</span> <span class="n">_token_splittable</span><span class="p">,</span>
<span class="gp">... </span><span class="n">standard_transformations</span><span class="p">,</span> <span class="n">implicit_multiplication</span><span class="p">,</span>
<span class="gp">... </span><span class="n">split_symbols_custom</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">def</span> <span class="nf">can_split</span><span class="p">(</span><span class="n">symbol</span><span class="p">):</span>
<span class="gp">... </span>    <span class="k">if</span> <span class="n">symbol</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">(</span><span class="s1">&#39;list&#39;</span><span class="p">,</span> <span class="s1">&#39;of&#39;</span><span class="p">,</span> <span class="s1">&#39;unsplittable&#39;</span><span class="p">,</span> <span class="s1">&#39;names&#39;</span><span class="p">):</span>
<span class="gp">... </span>            <span class="k">return</span> <span class="n">_token_splittable</span><span class="p">(</span><span class="n">symbol</span><span class="p">)</span>
<span class="gp">... </span>    <span class="k">return</span> <span class="kc">False</span>
<span class="gp">...</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">transformation</span> <span class="o">=</span> <span class="n">split_symbols_custom</span><span class="p">(</span><span class="n">can_split</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">parse_expr</span><span class="p">(</span><span class="s1">&#39;unsplittable&#39;</span><span class="p">,</span> <span class="n">transformations</span><span class="o">=</span><span class="n">standard_transformations</span> <span class="o">+</span>
<span class="gp">... </span><span class="p">(</span><span class="n">transformation</span><span class="p">,</span> <span class="n">implicit_multiplication</span><span class="p">))</span>
<span class="go">unsplittable</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.parsing.sympy_parser.implicit_multiplication">
<span class="sig-prename descclassname"><span class="pre">sympy.parsing.sympy_parser.</span></span><span class="sig-name descname"><span class="pre">implicit_multiplication</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">result</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">local_dict</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">global_dict</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/sympy_parser.py#L460-L482"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.sympy_parser.implicit_multiplication" title="Permalink to this definition">¶</a></dt>
<dd><p>Makes the multiplication operator optional in most cases.</p>
<p>Use this before <a class="reference internal" href="#sympy.parsing.sympy_parser.implicit_application" title="sympy.parsing.sympy_parser.implicit_application"><code class="xref py py-func docutils literal notranslate"><span class="pre">implicit_application()</span></code></a>, otherwise expressions like
<code class="docutils literal notranslate"><span class="pre">sin</span> <span class="pre">2x</span></code> will be parsed as <code class="docutils literal notranslate"><span class="pre">x</span> <span class="pre">*</span> <span class="pre">sin(2)</span></code> rather than <code class="docutils literal notranslate"><span class="pre">sin(2*x)</span></code>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.parsing.sympy_parser</span> <span class="kn">import</span> <span class="p">(</span><span class="n">parse_expr</span><span class="p">,</span>
<span class="gp">... </span><span class="n">standard_transformations</span><span class="p">,</span> <span class="n">implicit_multiplication</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">transformations</span> <span class="o">=</span> <span class="n">standard_transformations</span> <span class="o">+</span> <span class="p">(</span><span class="n">implicit_multiplication</span><span class="p">,)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">parse_expr</span><span class="p">(</span><span class="s1">&#39;3 x y&#39;</span><span class="p">,</span> <span class="n">transformations</span><span class="o">=</span><span class="n">transformations</span><span class="p">)</span>
<span class="go">3*x*y</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.parsing.sympy_parser.implicit_application">
<span class="sig-prename descclassname"><span class="pre">sympy.parsing.sympy_parser.</span></span><span class="sig-name descname"><span class="pre">implicit_application</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">result</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">local_dict</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">global_dict</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/sympy_parser.py#L485-L507"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.sympy_parser.implicit_application" title="Permalink to this definition">¶</a></dt>
<dd><p>Makes parentheses optional in some cases for function calls.</p>
<p>Use this after <a class="reference internal" href="#sympy.parsing.sympy_parser.implicit_multiplication" title="sympy.parsing.sympy_parser.implicit_multiplication"><code class="xref py py-func docutils literal notranslate"><span class="pre">implicit_multiplication()</span></code></a>, otherwise expressions
like <code class="docutils literal notranslate"><span class="pre">sin</span> <span class="pre">2x</span></code> will be parsed as <code class="docutils literal notranslate"><span class="pre">x</span> <span class="pre">*</span> <span class="pre">sin(2)</span></code> rather than
<code class="docutils literal notranslate"><span class="pre">sin(2*x)</span></code>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.parsing.sympy_parser</span> <span class="kn">import</span> <span class="p">(</span><span class="n">parse_expr</span><span class="p">,</span>
<span class="gp">... </span><span class="n">standard_transformations</span><span class="p">,</span> <span class="n">implicit_application</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">transformations</span> <span class="o">=</span> <span class="n">standard_transformations</span> <span class="o">+</span> <span class="p">(</span><span class="n">implicit_application</span><span class="p">,)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">parse_expr</span><span class="p">(</span><span class="s1">&#39;cot z + csc z&#39;</span><span class="p">,</span> <span class="n">transformations</span><span class="o">=</span><span class="n">transformations</span><span class="p">)</span>
<span class="go">cot(z) + csc(z)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.parsing.sympy_parser.function_exponentiation">
<span class="sig-prename descclassname"><span class="pre">sympy.parsing.sympy_parser.</span></span><span class="sig-name descname"><span class="pre">function_exponentiation</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tokens</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">local_dict</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">global_dict</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/sympy_parser.py#L318-L367"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.sympy_parser.function_exponentiation" title="Permalink to this definition">¶</a></dt>
<dd><p>Allows functions to be exponentiated, e.g. <code class="docutils literal notranslate"><span class="pre">cos**2(x)</span></code>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.parsing.sympy_parser</span> <span class="kn">import</span> <span class="p">(</span><span class="n">parse_expr</span><span class="p">,</span>
<span class="gp">... </span><span class="n">standard_transformations</span><span class="p">,</span> <span class="n">function_exponentiation</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">transformations</span> <span class="o">=</span> <span class="n">standard_transformations</span> <span class="o">+</span> <span class="p">(</span><span class="n">function_exponentiation</span><span class="p">,)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">parse_expr</span><span class="p">(</span><span class="s1">&#39;sin**4(x)&#39;</span><span class="p">,</span> <span class="n">transformations</span><span class="o">=</span><span class="n">transformations</span><span class="p">)</span>
<span class="go">sin(x)**4</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.parsing.sympy_parser.implicit_multiplication_application">
<span class="sig-prename descclassname"><span class="pre">sympy.parsing.sympy_parser.</span></span><span class="sig-name descname"><span class="pre">implicit_multiplication_application</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">result</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">local_dict</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">global_dict</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/sympy_parser.py#L510-L537"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.sympy_parser.implicit_multiplication_application" title="Permalink to this definition">¶</a></dt>
<dd><p>Allows a slightly relaxed syntax.</p>
<ul class="simple">
<li><p>Parentheses for single-argument method calls are optional.</p></li>
<li><p>Multiplication is implicit.</p></li>
<li><p>Symbol names can be split (i.e. spaces are not needed between
symbols).</p></li>
<li><p>Functions can be exponentiated.</p></li>
</ul>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.parsing.sympy_parser</span> <span class="kn">import</span> <span class="p">(</span><span class="n">parse_expr</span><span class="p">,</span>
<span class="gp">... </span><span class="n">standard_transformations</span><span class="p">,</span> <span class="n">implicit_multiplication_application</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">parse_expr</span><span class="p">(</span><span class="s2">&quot;10sin**2 x**2 + 3xyz + tan theta&quot;</span><span class="p">,</span>
<span class="gp">... </span><span class="n">transformations</span><span class="o">=</span><span class="p">(</span><span class="n">standard_transformations</span> <span class="o">+</span>
<span class="gp">... </span><span class="p">(</span><span class="n">implicit_multiplication_application</span><span class="p">,)))</span>
<span class="go">3*x*y*z + 10*sin(x**2)**2 + tan(theta)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.parsing.sympy_parser.rationalize">
<span class="sig-prename descclassname"><span class="pre">sympy.parsing.sympy_parser.</span></span><span class="sig-name descname"><span class="pre">rationalize</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tokens</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">local_dict</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">global_dict</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/sympy_parser.py#L795-L811"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.sympy_parser.rationalize" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts floats into <code class="docutils literal notranslate"><span class="pre">Rational</span></code>. Run AFTER <code class="docutils literal notranslate"><span class="pre">auto_number</span></code>.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.parsing.sympy_parser.convert_xor">
<span class="sig-prename descclassname"><span class="pre">sympy.parsing.sympy_parser.</span></span><span class="sig-name descname"><span class="pre">convert_xor</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tokens</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">local_dict</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">global_dict</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/sympy_parser.py#L655-L667"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.sympy_parser.convert_xor" title="Permalink to this definition">¶</a></dt>
<dd><p>Treats XOR, <code class="docutils literal notranslate"><span class="pre">^</span></code>, as exponentiation, <code class="docutils literal notranslate"><span class="pre">**</span></code>.</p>
</dd></dl>

<p>These are included in
:data:<code class="docutils literal notranslate"><span class="pre">sympy.parsing.sympy_parser.standard_transformations</span></code> and generally
don’t need to be manually added by the user.</p>
<dl class="py function">
<dt class="sig sig-object py" id="sympy.parsing.sympy_parser.lambda_notation">
<span class="sig-prename descclassname"><span class="pre">sympy.parsing.sympy_parser.</span></span><span class="sig-name descname"><span class="pre">lambda_notation</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tokens</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">local_dict</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">global_dict</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/sympy_parser.py#L591-L628"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.sympy_parser.lambda_notation" title="Permalink to this definition">¶</a></dt>
<dd><p>Substitutes “lambda” with its Sympy equivalent Lambda().
However, the conversion doesn’t take place if only “lambda”
is passed because that is a syntax error.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.parsing.sympy_parser.auto_symbol">
<span class="sig-prename descclassname"><span class="pre">sympy.parsing.sympy_parser.</span></span><span class="sig-name descname"><span class="pre">auto_symbol</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tokens</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">local_dict</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">global_dict</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/sympy_parser.py#L540-L588"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.sympy_parser.auto_symbol" title="Permalink to this definition">¶</a></dt>
<dd><p>Inserts calls to <code class="docutils literal notranslate"><span class="pre">Symbol</span></code>/<code class="docutils literal notranslate"><span class="pre">Function</span></code> for undefined variables.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.parsing.sympy_parser.repeated_decimals">
<span class="sig-prename descclassname"><span class="pre">sympy.parsing.sympy_parser.</span></span><span class="sig-name descname"><span class="pre">repeated_decimals</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tokens</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">local_dict</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">global_dict</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/sympy_parser.py#L670-L758"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.sympy_parser.repeated_decimals" title="Permalink to this definition">¶</a></dt>
<dd><p>Allows 0.2[1] notation to represent the repeated decimal 0.2111… (19/90)</p>
<p>Run this before auto_number.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.parsing.sympy_parser.auto_number">
<span class="sig-prename descclassname"><span class="pre">sympy.parsing.sympy_parser.</span></span><span class="sig-name descname"><span class="pre">auto_number</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tokens</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">local_dict</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">global_dict</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/sympy_parser.py#L761-L792"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.sympy_parser.auto_number" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts numeric literals to use SymPy equivalents.</p>
<p>Complex numbers use <code class="docutils literal notranslate"><span class="pre">I</span></code>, integer literals use <code class="docutils literal notranslate"><span class="pre">Integer</span></code>, and float
literals use <code class="docutils literal notranslate"><span class="pre">Float</span></code>.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.parsing.sympy_parser.factorial_notation">
<span class="sig-prename descclassname"><span class="pre">sympy.parsing.sympy_parser.</span></span><span class="sig-name descname"><span class="pre">factorial_notation</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tokens</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">local_dict</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">global_dict</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/sympy_parser.py#L631-L652"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.sympy_parser.factorial_notation" title="Permalink to this definition">¶</a></dt>
<dd><p>Allows standard notation for factorial.</p>
</dd></dl>

</section>
<section id="experimental-mathrm-latex-parsing">
<h2>Experimental <span class="math notranslate nohighlight">\(\mathrm{\LaTeX}\)</span> Parsing<a class="headerlink" href="#experimental-mathrm-latex-parsing" title="Permalink to this headline">¶</a></h2>
<p><span class="math notranslate nohighlight">\(\mathrm{\LaTeX}\)</span> parsing was ported from
<a class="reference external" href="https://github.com/augustt198/latex2sympy">latex2sympy</a>. While functional
and its API should remain stable, the parsing behavior or backend may change in
future releases.</p>
</section>
<section id="mathrm-latex-parsing-caveats">
<h2><span class="math notranslate nohighlight">\(\mathrm{\LaTeX}\)</span> Parsing Caveats<a class="headerlink" href="#mathrm-latex-parsing-caveats" title="Permalink to this headline">¶</a></h2>
<p>The current implementation is experimental. The behavior, parser backend and
API might change in the future. Unlike some of the other parsers, <span class="math notranslate nohighlight">\(\mathrm{\LaTeX}\)</span> is
designed as a <em>type-setting</em> language, not a <em>computer algebra system</em> and so
can contain typographical conventions that might be interpreted multiple ways.</p>
<p>In its current definition, the parser will at times will fail to fully parse
the expression, but not throw a warning:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">parse_latex</span><span class="p">(</span><span class="sa">r</span><span class="s1">&#39;x -&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>Will simply find <code class="docutils literal notranslate"><span class="pre">x</span></code>. What is covered by this behavior will almost certainly
change between releases, and become stricter, more relaxed, or some mix.</p>
</section>
<section id="mathrm-latex-parsing-functions-reference">
<h2><span class="math notranslate nohighlight">\(\mathrm{\LaTeX}\)</span> Parsing Functions Reference<a class="headerlink" href="#mathrm-latex-parsing-functions-reference" title="Permalink to this headline">¶</a></h2>
<dl class="py function">
<dt class="sig sig-object py" id="sympy.parsing.latex.parse_latex">
<span class="sig-prename descclassname"><span class="pre">sympy.parsing.latex.</span></span><span class="sig-name descname"><span class="pre">parse_latex</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">s</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/latex/__init__.py#L6-L35"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.latex.parse_latex" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the string <code class="docutils literal notranslate"><span class="pre">s</span></code> to a SymPy <code class="docutils literal notranslate"><span class="pre">Expr</span></code></p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>s</strong> : str</p>
<blockquote>
<div><p>The LaTeX string to parse. In Python source containing LaTeX,
<em>raw strings</em> (denoted with <code class="docutils literal notranslate"><span class="pre">r&quot;</span></code>, like this one) are preferred,
as LaTeX makes liberal use of the <code class="docutils literal notranslate"><span class="pre">\</span></code> character, which would
trigger escaping in normal Python strings.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.parsing.latex</span> <span class="kn">import</span> <span class="n">parse_latex</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">expr</span> <span class="o">=</span> <span class="n">parse_latex</span><span class="p">(</span><span class="sa">r</span><span class="s2">&quot;\frac {1 + \sqrt {\a}} {\b}&quot;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">expr</span>
<span class="go">(sqrt(a) + 1)/b</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">expr</span><span class="o">.</span><span class="n">evalf</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="n">subs</span><span class="o">=</span><span class="nb">dict</span><span class="p">(</span><span class="n">a</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">b</span><span class="o">=</span><span class="mi">2</span><span class="p">))</span>
<span class="go">1.618</span>
</pre></div>
</div>
</dd></dl>

</section>
<section id="mathrm-latex-parsing-exceptions-reference">
<h2><span class="math notranslate nohighlight">\(\mathrm{\LaTeX}\)</span> Parsing Exceptions Reference<a class="headerlink" href="#mathrm-latex-parsing-exceptions-reference" title="Permalink to this headline">¶</a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="sympy.parsing.latex.LaTeXParsingError">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.parsing.latex.</span></span><span class="sig-name descname"><span class="pre">LaTeXParsingError</span></span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/latex/errors.py#L1-L2"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.latex.LaTeXParsingError" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</section>
<section id="module-sympy.parsing.sym_expr">
<span id="sympy-expression-reference"></span><h2>SymPy Expression Reference<a class="headerlink" href="#module-sympy.parsing.sym_expr" title="Permalink to this headline">¶</a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="sympy.parsing.sym_expr.SymPyExpression">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.parsing.sym_expr.</span></span><span class="sig-name descname"><span class="pre">SymPyExpression</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">source_code</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mode</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/sym_expr.py#L13-L279"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.sym_expr.SymPyExpression" title="Permalink to this definition">¶</a></dt>
<dd><p>Class to store and handle SymPy expressions</p>
<p>This class will hold SymPy Expressions and handle the API for the
conversion to and from different languages.</p>
<p>It works with the C and the Fortran Parser to generate SymPy expressions
which are stored here and which can be converted to multiple language’s
source code.</p>
<p class="rubric">Notes</p>
<p>The module and its API are currently under development and experimental
and can be changed during development.</p>
<p>The Fortran parser does not support numeric assignments, so all the
variables have been Initialized to zero.</p>
<p>The module also depends on external dependencies:</p>
<ul class="simple">
<li><p>LFortran which is required to use the Fortran parser</p></li>
<li><p>Clang which is required for the C parser</p></li>
</ul>
<p class="rubric">Examples</p>
<p>Example of parsing C code:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.parsing.sym_expr</span> <span class="kn">import</span> <span class="n">SymPyExpression</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">src</span> <span class="o">=</span> <span class="s1">&#39;&#39;&#39;</span>
<span class="gp">... </span><span class="s1">int a,b;</span>
<span class="gp">... </span><span class="s1">float c = 2, d =4;</span>
<span class="gp">... </span><span class="s1">&#39;&#39;&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">SymPyExpression</span><span class="p">(</span><span class="n">src</span><span class="p">,</span> <span class="s1">&#39;c&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="o">.</span><span class="n">return_expr</span><span class="p">()</span>
<span class="go">[Declaration(Variable(a, type=intc)),</span>
<span class="go">Declaration(Variable(b, type=intc)),</span>
<span class="go">Declaration(Variable(c, type=float32, value=2.0)),</span>
<span class="go">Declaration(Variable(d, type=float32, value=4.0))]</span>
</pre></div>
</div>
<p>An example of variable definiton:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.parsing.sym_expr</span> <span class="kn">import</span> <span class="n">SymPyExpression</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">src2</span> <span class="o">=</span> <span class="s1">&#39;&#39;&#39;</span>
<span class="gp">... </span><span class="s1">integer :: a, b, c, d</span>
<span class="gp">... </span><span class="s1">real :: p, q, r, s</span>
<span class="gp">... </span><span class="s1">&#39;&#39;&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">SymPyExpression</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">convert_to_expr</span><span class="p">(</span><span class="n">src2</span><span class="p">,</span> <span class="s1">&#39;f&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">convert_to_c</span><span class="p">()</span>
<span class="go">[&#39;int a = 0&#39;, &#39;int b = 0&#39;, &#39;int c = 0&#39;, &#39;int d = 0&#39;, &#39;double p = 0.0&#39;, &#39;double q = 0.0&#39;, &#39;double r = 0.0&#39;, &#39;double s = 0.0&#39;]</span>
</pre></div>
</div>
<p>An example of Assignment:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.parsing.sym_expr</span> <span class="kn">import</span> <span class="n">SymPyExpression</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">src3</span> <span class="o">=</span> <span class="s1">&#39;&#39;&#39;</span>
<span class="gp">... </span><span class="s1">integer :: a, b, c, d, e</span>
<span class="gp">... </span><span class="s1">d = a + b - c</span>
<span class="gp">... </span><span class="s1">e = b * d + c * e / a</span>
<span class="gp">... </span><span class="s1">&#39;&#39;&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">SymPyExpression</span><span class="p">(</span><span class="n">src3</span><span class="p">,</span> <span class="s1">&#39;f&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">convert_to_python</span><span class="p">()</span>
<span class="go">[&#39;a = 0&#39;, &#39;b = 0&#39;, &#39;c = 0&#39;, &#39;d = 0&#39;, &#39;e = 0&#39;, &#39;d = a + b - c&#39;, &#39;e = b*d + c*e/a&#39;]</span>
</pre></div>
</div>
<p>An example of function definition:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.parsing.sym_expr</span> <span class="kn">import</span> <span class="n">SymPyExpression</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">src</span> <span class="o">=</span> <span class="s1">&#39;&#39;&#39;</span>
<span class="gp">... </span><span class="s1">integer function f(a,b)</span>
<span class="gp">... </span><span class="s1">integer, intent(in) :: a, b</span>
<span class="gp">... </span><span class="s1">integer :: r</span>
<span class="gp">... </span><span class="s1">end function</span>
<span class="gp">... </span><span class="s1">&#39;&#39;&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">SymPyExpression</span><span class="p">(</span><span class="n">src</span><span class="p">,</span> <span class="s1">&#39;f&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="o">.</span><span class="n">convert_to_python</span><span class="p">()</span>
<span class="go">[&#39;def f(a, b):\n   f = 0\n    r = 0\n    return f&#39;]</span>
</pre></div>
</div>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.parsing.sym_expr.SymPyExpression.convert_to_c">
<span class="sig-name descname"><span class="pre">convert_to_c</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/sym_expr.py#L201-L226"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.sym_expr.SymPyExpression.convert_to_c" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a list with the c source code for the sympy expressions</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.parsing.sym_expr</span> <span class="kn">import</span> <span class="n">SymPyExpression</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">src2</span> <span class="o">=</span> <span class="s1">&#39;&#39;&#39;</span>
<span class="gp">... </span><span class="s1">integer :: a, b, c, d</span>
<span class="gp">... </span><span class="s1">real :: p, q, r, s</span>
<span class="gp">... </span><span class="s1">c = a/b</span>
<span class="gp">... </span><span class="s1">d = c/a</span>
<span class="gp">... </span><span class="s1">s = p/q</span>
<span class="gp">... </span><span class="s1">r = q/p</span>
<span class="gp">... </span><span class="s1">&#39;&#39;&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">SymPyExpression</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">convert_to_expr</span><span class="p">(</span><span class="n">src2</span><span class="p">,</span> <span class="s1">&#39;f&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">convert_to_c</span><span class="p">()</span>
<span class="go">[&#39;int a = 0&#39;, &#39;int b = 0&#39;, &#39;int c = 0&#39;, &#39;int d = 0&#39;, &#39;double p = 0.0&#39;, &#39;double q = 0.0&#39;, &#39;double r = 0.0&#39;, &#39;double s = 0.0&#39;, &#39;c = a/b;&#39;, &#39;d = c/a;&#39;, &#39;s = p/q;&#39;, &#39;r = q/p;&#39;]</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.parsing.sym_expr.SymPyExpression.convert_to_expr">
<span class="sig-name descname"><span class="pre">convert_to_expr</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">src_code</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mode</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/sym_expr.py#L120-L174"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.sym_expr.SymPyExpression.convert_to_expr" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the given source code to sympy Expressions</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.parsing.sym_expr</span> <span class="kn">import</span> <span class="n">SymPyExpression</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">src3</span> <span class="o">=</span> <span class="s1">&#39;&#39;&#39;</span>
<span class="gp">... </span><span class="s1">integer function f(a,b) result(r)</span>
<span class="gp">... </span><span class="s1">integer, intent(in) :: a, b</span>
<span class="gp">... </span><span class="s1">integer :: x</span>
<span class="gp">... </span><span class="s1">r = a + b -x</span>
<span class="gp">... </span><span class="s1">end function</span>
<span class="gp">... </span><span class="s1">&#39;&#39;&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">SymPyExpression</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">convert_to_expr</span><span class="p">(</span><span class="n">src3</span><span class="p">,</span> <span class="s1">&#39;f&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">return_expr</span><span class="p">()</span>
<span class="go">[FunctionDefinition(integer, name=f, parameters=(Variable(a), Variable(b)), body=CodeBlock(</span>
<span class="go">Declaration(Variable(r, type=integer, value=0)),</span>
<span class="go">Declaration(Variable(x, type=integer, value=0)),</span>
<span class="go">Assignment(Variable(r), a + b - x),</span>
<span class="go">Return(Variable(r))</span>
<span class="go">))]</span>
</pre></div>
</div>
<p class="rubric">Attributes</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 9%" />
<col style="width: 91%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>src_code</p></td>
<td><p>(String) the source code or filename of the source code that is to be converted</p></td>
</tr>
<tr class="row-even"><td><p>mode: String</p></td>
<td><p>the mode to determine which parser is to be used according to the language of the source code f or F for Fortran c or C for C/C++</p></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.parsing.sym_expr.SymPyExpression.convert_to_fortran">
<span class="sig-name descname"><span class="pre">convert_to_fortran</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/sym_expr.py#L228-L251"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.sym_expr.SymPyExpression.convert_to_fortran" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a list with the fortran source code for the sympy expressions</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.parsing.sym_expr</span> <span class="kn">import</span> <span class="n">SymPyExpression</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">src2</span> <span class="o">=</span> <span class="s1">&#39;&#39;&#39;</span>
<span class="gp">... </span><span class="s1">integer :: a, b, c, d</span>
<span class="gp">... </span><span class="s1">real :: p, q, r, s</span>
<span class="gp">... </span><span class="s1">c = a/b</span>
<span class="gp">... </span><span class="s1">d = c/a</span>
<span class="gp">... </span><span class="s1">s = p/q</span>
<span class="gp">... </span><span class="s1">r = q/p</span>
<span class="gp">... </span><span class="s1">&#39;&#39;&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">SymPyExpression</span><span class="p">(</span><span class="n">src2</span><span class="p">,</span> <span class="s1">&#39;f&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">convert_to_fortran</span><span class="p">()</span>
<span class="go">[&#39;      integer*4 a&#39;, &#39;      integer*4 b&#39;, &#39;      integer*4 c&#39;, &#39;      integer*4 d&#39;, &#39;      real*8 p&#39;, &#39;      real*8 q&#39;, &#39;      real*8 r&#39;, &#39;      real*8 s&#39;, &#39;      c = a/b&#39;, &#39;      d = c/a&#39;, &#39;      s = p/q&#39;, &#39;      r = q/p&#39;]</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.parsing.sym_expr.SymPyExpression.convert_to_python">
<span class="sig-name descname"><span class="pre">convert_to_python</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/sym_expr.py#L176-L199"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.sym_expr.SymPyExpression.convert_to_python" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a list with python code for the sympy expressions</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.parsing.sym_expr</span> <span class="kn">import</span> <span class="n">SymPyExpression</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">src2</span> <span class="o">=</span> <span class="s1">&#39;&#39;&#39;</span>
<span class="gp">... </span><span class="s1">integer :: a, b, c, d</span>
<span class="gp">... </span><span class="s1">real :: p, q, r, s</span>
<span class="gp">... </span><span class="s1">c = a/b</span>
<span class="gp">... </span><span class="s1">d = c/a</span>
<span class="gp">... </span><span class="s1">s = p/q</span>
<span class="gp">... </span><span class="s1">r = q/p</span>
<span class="gp">... </span><span class="s1">&#39;&#39;&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">SymPyExpression</span><span class="p">(</span><span class="n">src2</span><span class="p">,</span> <span class="s1">&#39;f&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">convert_to_python</span><span class="p">()</span>
<span class="go">[&#39;a = 0&#39;, &#39;b = 0&#39;, &#39;c = 0&#39;, &#39;d = 0&#39;, &#39;p = 0.0&#39;, &#39;q = 0.0&#39;, &#39;r = 0.0&#39;, &#39;s = 0.0&#39;, &#39;c = a/b&#39;, &#39;d = c/a&#39;, &#39;s = p/q&#39;, &#39;r = q/p&#39;]</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.parsing.sym_expr.SymPyExpression.return_expr">
<span class="sig-name descname"><span class="pre">return_expr</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/parsing/sym_expr.py#L253-L279"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.parsing.sym_expr.SymPyExpression.return_expr" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the expression list</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.parsing.sym_expr</span> <span class="kn">import</span> <span class="n">SymPyExpression</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">src3</span> <span class="o">=</span> <span class="s1">&#39;&#39;&#39;</span>
<span class="gp">... </span><span class="s1">integer function f(a,b)</span>
<span class="gp">... </span><span class="s1">integer, intent(in) :: a, b</span>
<span class="gp">... </span><span class="s1">integer :: r</span>
<span class="gp">... </span><span class="s1">r = a+b</span>
<span class="gp">... </span><span class="s1">f = r</span>
<span class="gp">... </span><span class="s1">end function</span>
<span class="gp">... </span><span class="s1">&#39;&#39;&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">SymPyExpression</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">convert_to_expr</span><span class="p">(</span><span class="n">src3</span><span class="p">,</span> <span class="s1">&#39;f&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">return_expr</span><span class="p">()</span>
<span class="go">[FunctionDefinition(integer, name=f, parameters=(Variable(a), Variable(b)), body=CodeBlock(</span>
<span class="go">Declaration(Variable(f, type=integer, value=0)),</span>
<span class="go">Declaration(Variable(r, type=integer, value=0)),</span>
<span class="go">Assignment(Variable(f), Variable(r)),</span>
<span class="go">Return(Variable(f))</span>
<span class="go">))]</span>
</pre></div>
</div>
</dd></dl>

</dd></dl>

</section>
<section id="runtime-installation">
<h2>Runtime Installation<a class="headerlink" href="#runtime-installation" title="Permalink to this headline">¶</a></h2>
<p>The currently-packaged LaTeX parser backend is partially generated with
<a class="reference external" href="http://antlr4.org/">ANTLR4</a>,
but to use the parser, you only need the <code class="docutils literal notranslate"><span class="pre">antlr4</span></code> Python package available.</p>
<p>Depending on your package manager, you can install the right package with, for
example, <code class="docutils literal notranslate"><span class="pre">pip3</span></code> (Python 3 only):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ pip3 install antlr4-python3-runtime
</pre></div>
</div>
<p>or <code class="docutils literal notranslate"><span class="pre">pip</span></code> (Python 2 only):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ pip install antlr4-python2-runtime
</pre></div>
</div>
<p>or <code class="docutils literal notranslate"><span class="pre">conda</span></code> (Python 2 or Python 3):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ conda install --channel=conda-forge antlr-python-runtime
</pre></div>
</div>
<p>The C parser depends on <code class="docutils literal notranslate"><span class="pre">clang</span></code> and the Fortran parser depends on <code class="docutils literal notranslate"><span class="pre">LFortran</span></code>.
You can install these packages using:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ conda install -c conda-forge lfortran clang
</pre></div>
</div>
</section>
</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../index.html">
              <img class="logo" src="../_static/sympylogo.png" alt="Logo"/>
            </a></p>
  <h3><a href="../index.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Parsing</a><ul>
<li><a class="reference internal" href="#parsing-functions-reference">Parsing Functions Reference</a></li>
<li><a class="reference internal" href="#parsing-transformations-reference">Parsing Transformations Reference</a></li>
<li><a class="reference internal" href="#experimental-mathrm-latex-parsing">Experimental <span class="math notranslate nohighlight">\(\mathrm{\LaTeX}\)</span> Parsing</a></li>
<li><a class="reference internal" href="#mathrm-latex-parsing-caveats"><span class="math notranslate nohighlight">\(\mathrm{\LaTeX}\)</span> Parsing Caveats</a></li>
<li><a class="reference internal" href="#mathrm-latex-parsing-functions-reference"><span class="math notranslate nohighlight">\(\mathrm{\LaTeX}\)</span> Parsing Functions Reference</a></li>
<li><a class="reference internal" href="#mathrm-latex-parsing-exceptions-reference"><span class="math notranslate nohighlight">\(\mathrm{\LaTeX}\)</span> Parsing Exceptions Reference</a></li>
<li><a class="reference internal" href="#module-sympy.parsing.sym_expr">SymPy Expression Reference</a></li>
<li><a class="reference internal" href="#runtime-installation">Runtime Installation</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="solvers/ode.html"
                        title="previous chapter">ODE</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="solvers/pde.html"
                        title="next chapter">PDE</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../_sources/modules/parsing.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="https://docs.sympy.org/latest/search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="solvers/pde.html" title="PDE"
             >next</a> |</li>
        <li class="right" >
          <a href="solvers/ode.html" title="ODE"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="index.html" >SymPy Modules Reference</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Parsing</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2021 SymPy Development Team.
      Last updated on Sep 30, 2021.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.1.2.
    </div>
  </body>

<!-- Mirrored from docs.sympy.org/latest/modules/parsing.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:24:35 GMT -->
</html>